package Demo4;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-14
 * Time: 9:31
 */
//组合
class A{

}
class B extends A{

}
class C extends B{

}

class Student{
    public int age;

    public Student(){
        this.age = age;
    }
}
class Teacher{
    public int age;

}
class School{
    private Student[] students;
    public Teacher teachers;

    public Student[] getStudents() {
        return students;
    }

    public void setStudents(Student[] students) {
        this.students = students;
    }

    public Teacher getTeachers() {
        return teachers;
    }

    public void setTeachers(Teacher teachers) {
        this.teachers = teachers;
    }
}

public class Test {
    public static void main(String[] args) {
        School school = new School();

        school.setStudents(new Student[]{new Student(),new Student()});
        System.out.println(school.getStudents()[0].age=3);

        school.setTeachers(new Teacher());
        System.out.println(school.getTeachers());

        Teacher teacher = new Teacher();
        school.teachers = new Teacher();

        System.out.println(school.teachers.age=1);
    }
}
